Skip to content

[clang] Compiler builtin for deduping a list of types #105817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

usx95
Copy link
Contributor

@usx95 usx95 commented Aug 23, 2024

This is a work-in-progress prototype/proposal for deduping a list of types. The primary motivation of this proposal is to reduce compile times when we need to deduplicate a large number of types.

This problem comes up a lot in practice and non-compiler metaprogramming counterpart solution become painfully slow for large number of types, often resorting to O(N) instantiations.

For data points, I have seen compilation units with metaprogramming constructs attempting to dedup ~5000 types. A single deduplication contributes to a whopping 20% of compile time of such compilation units.

TODO: Add tests.
TODO: Add docs.
TODO: Add correct diagnostics for bad usage.

@usx95 usx95 self-assigned this Jul 19, 2025
@usx95 usx95 closed this Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant